package com.scpii.api.controller.user;

import javax.annotation.Resource;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.scpii.api.common.base.BaseController;
import com.scpii.api.service.user.UsersService;

@Controller
@RequestMapping("/user/validcode")
public class ValidCodeController extends BaseController {

	@Resource
	private UsersService usersService;

	@PreAuthorize("hasRole('ROLE_CLIENT')")
	@RequestMapping(value = "/{phone}", method = RequestMethod.GET)
	@ResponseBody
	public Boolean getValidCode(@PathVariable("phone") String phone) {
		usersService.insertUsersValidCode(phone);
		return true;
	}
}
